package com.cxyd.modules.wms.service;

import com.cxyd.common.page.PageData;
import com.cxyd.common.service.CrudService;
import com.cxyd.common.utils.ProcResult;
import com.cxyd.common.utils.Result;
import com.cxyd.modules.api.dto.StockDetailDTO;
import com.cxyd.modules.api.dto.request.TaskRequest;
import com.cxyd.modules.wms.dto.SpuDTO;
import com.cxyd.modules.wms.dto.StockDTO;
import com.cxyd.modules.wms.dto.TaskDTO;
import com.cxyd.modules.wms.dto.po.StockAggregatedPo;
import com.cxyd.modules.wms.dto.po.StockSumPo;
import com.cxyd.modules.wms.entity.StockEntity;
import com.cxyd.modules.wms.excel.ImportStockExcel;
import com.cxyd.modules.wms.excel.StockExcel;

import java.util.List;
import java.util.Map;

/**
 * 库存信息
 *
 * @author g_Cycle gengruyi01@163.com
 * @since 1.0.0 2023-04-27
 */
public interface StockService extends CrudService<StockEntity, StockDTO> {
    List<StockDetailDTO> stockQuery(Map<String, Object> params);

    PageData<StockDTO> checkPage(Map<String, Object> params);

    PageData<StockExcel> zonePage(Map<String, Object> params);

    /**
     * 一键禁用（解禁）库存
     * @param ids
     * @param status 0-禁用库存 1-解禁库存
     */
    void stockDisables(List<Long> ids,Integer status);

    ProcResult stockFreeze(Map<String, Object> params);

    void stockCheck(Map<String, Object> params);

    void mergeCall(Map<String, Object> params);

    void stockInsert(StockEntity insertStock);

    Result checkAffirm(TaskRequest request);

    void outbound(Map<String, Object> params);

    void cancel(Map<String, Object> params);

    Result outboundCompleted(TaskRequest request);

    Result outboundCompletedZero(TaskRequest request);

    /**
     * 批量保存或更新库存信息
     * @param list
     * @return
     */
    int batchSaveOrUpdate(List<ImportStockExcel> list);

    List<StockEntity> selectByCurPosition(String curPosition);

    /**
     * 异常空箱库存添加
     * @param map
     * @return
     */
    Result errorContAdd(Map<String,Object> map);

    PageData<StockAggregatedPo> pageBySpuNo(Map<String, Object> params);
    PageData<StockSumPo> sumStock(Map<String, Object> params);

    List<StockSumPo> sumStockExport(Map<String, Object> params);

    PageData<StockAggregatedPo> pageByZoneNo(Map<String, Object> params);

    List<StockAggregatedPo> orderBySpuNo(Map<String, Object> params);

    List<StockAggregatedPo> orderByZoneNo(Map<String, Object> params);
}